package base.day22.stream;

import java.util.ArrayList;
import java.util.function.Predicate;

public class MyStream5 {
    public static void main(String[] args) {
        ArrayList<Integer> list=new ArrayList<>();
        for (int i = 1; i < 10; i++) {
            list.add(i);
        }

        list.stream().filter(new Predicate<Integer>() {
            @Override
            public boolean test(Integer i) {
                int  result=i%2;
                boolean flag=result==0?true:false;
                return flag;
            }
        }).forEach(i-> System.out.println(i));

        list.stream().filter(
                (Integer i)->{
                    return i%2==0;
                }
        ).forEach(i-> System.out.println(i));

        list.stream().filter(i->i%2==0).forEach(i-> System.out.println(i));
    }
}
